var timer=new Object();var ab=new Object();var bb=new Object();var cb=db();var eb=0;var auto_reload=1;var fb=new Object();var	is_opera=window.opera!==undefined;var	is_ie=document.all!==undefined&&window.opera===undefined;var is_ie6p=document.compatMode!==undefined&&document.all!==undefined&&window.opera===undefined;var is_ie7=document.documentElement!==undefined&&document.documentElement.style.maxHeight!==undefined;var is_ie6=is_ie6p&&!is_ie7;var is_ff2p=window.Iterator!==undefined;var is_ff3p=document.getElementsByClassName!==undefined;var is_ff2=is_ff2p&&!is_ff3p
function gb(){return hb('height');}
function ib(){return hb('width');}
function hb(jb){var kb=0,lb=0;if(typeof(window.innerWidth)=='number'){kb=window.innerWidth;lb=window.innerHeight;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){kb=document.documentElement.clientWidth;lb=document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){kb=document.body.clientWidth;lb=document.body.clientHeight;}
if(jb=='height')return lb;if(jb=='width')return kb;}
var gmwds=false;function start(){mb("l1");mb("l2");mb("l3");mb("l4");initCounter();if(typeof init_local=='function'){init_local();}
if(quest.number===null){qst_handle();}
if(gmwds){gmwd();}
}
function nb(){return new Date().getTime();}
function db(){return Math.round(nb()/1000);}
function ob(pb){p=pb.innerHTML.split(":");qb=p[0]*3600+p[1]*60+p[2]*1;return qb;}
function rb(s,sb){var tb,ub,vb;if(s>-2){tb=Math.floor(s/3600);ub=Math.floor(s/60)%60;vb=s%60;t=tb+":";if(ub<10){t+="0";}
t+=ub+":";if(vb<10){t+="0";}
t+=vb;}
else
{t=sb?'0:00:0?':"<a href=\"#\" onClick=\"return Popup(2,5);\"><span class=\"c0 t\">0:00:0</span>?</a>";}
return t;}
function initCounter(){for(var i=1;;i++){pb=document.getElementById("tp"+i);if(pb!=null){ab[i]=new Object();ab[i].node=pb;ab[i].counter_time=ob(pb);}
else{break;}
}
for(i=1;;i++){pb=document.getElementById("timer"+i);if(pb!=null){bb[i]=new Object();bb[i].node=pb;bb[i].counter_time=ob(pb);}
else{break;}
}
executeCounter();}
function executeCounter(){for(var i in ab){wb=db()-cb;xb=rb(ab[i].counter_time+wb);ab[i].node.innerHTML=xb;}
for(i in bb){wb=db()-cb;yb=bb[i].counter_time-wb
if(eb==0&&yb<1){eb=1;if(auto_reload==1){setTimeout("document.location.reload()",1000);}
else if(auto_reload==0){setTimeout("mreload()",1000);}
}
else{}
xb=rb(yb);bb[i].node.innerHTML=xb;}
if(eb==0){window.setTimeout("executeCounter()",1000);}
}
function mb(zb){pb=document.getElementById(zb);if(pb!=null){fb[zb]=new Object();var $b=pb.innerHTML.match(/(\d+)\/(\d+)/);element=$b[0].split("/");_b=parseInt(element[0]);ac=parseInt(element[1]);bc=pb.title;if(bc!=0){cc=nb();timer[zb]=new Object();timer[zb].start=cc;timer[zb].production=bc;timer[zb].start_res=_b;timer[zb].max_res=ac;timer[zb].ms=3600000/bc;dc=100;if(timer[zb].ms<dc){timer[zb].ms=dc;}
timer[zb].node=pb;executeTimer(zb);}
else
{timer[zb]=new Object();fb[zb].value=_b;}
}
}
function executeTimer(zb){wb=nb()-timer[zb].start;if(wb>=0){ec=Math.round(timer[zb].start_res+wb*(timer[zb].production/3600000));if(ec>=timer[zb].max_res){ec=timer[zb].max_res;}
else
{window.setTimeout("executeTimer('"+zb+"')",timer[zb].ms);}
fb[zb].value=ec;timer[zb].node.innerHTML=ec+'/'+timer[zb].max_res;}
}
var fc=new Array(0,0,0,0,0);function add_res(gc){hc=fb['l'+(5-gc)].value;ic=haendler*carry;fc[gc]=jc(fc[gc],hc,ic,carry);document.getElementById('r'+gc).value=fc[gc];}
function upd_res(gc,kc){hc=fb['l'+(5-gc)].value;ic=haendler*carry;if(kc){lc=hc;}
else
{lc=parseInt(document.getElementById('r'+gc).value);}
if(isNaN(lc)){lc=0;}
fc[gc]=jc(parseInt(lc),hc,ic,0);document.getElementById('r'+gc).value=fc[gc];}
function jc(mc,nc,oc,pc){qc=mc+pc;if(qc>nc){qc=nc;}
if(qc>oc){qc=oc;}
if(qc==0){qc='';}
return qc;}
function rc(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(var i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(var i=0;!x&&d.layers&&i<d.layers.length;i++)x=rc(n,d.layers[i].document);return x;}
function btm0(){var i,x,a=document.MM_sr;for(var i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function btm1(){var i,j=0,x,a=btm1.arguments;document.MM_sr=new Array;for(var i=0;i<(a.length-2);i+=3)if((x=rc(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}
}
function Popup(i,j){pb=document.getElementById("ce");if(pb!=null){var sc="<div class=\"popup3\"><iframe frameborder=\"0\" id=\"Frame\" src=\"manual.php?s="+i+"&typ="+j+"\" width=\"412\" height=\"440\" border=\"0\"></iframe></div><a href=\"#\" onClick=\"Close(); return false;\"><img src=\"img/x.gif\" border=\"1\" class=\"popup4\" alt=\"Close\"></a>";pb.innerHTML=sc;}
tc();if(!is_ie6&&!uc)return false;else return true;}
function tc(){if(gb()<700||ib()<700){document.getElementById("ce").style.position='absolute';uc=true;}
else{document.getElementById("ce").style.position='fixed';uc=false;}
}
function Close(){pb=document.getElementById("ce");if(pb!=null){pb.innerHTML='';}
if(quest.anmstep!==false){quest.anmstep=false;}
}
function Allmsg(){for(var x=0;x<document.msg.elements.length;x++){var y=document.msg.elements[x];if(y.name!='s10')y.checked=document.msg.s10.checked;}
}
function xy(){vc=screen.width+":"+screen.height;document.snd.w.value=vc;}
function my_village(){var wc=Math.round(0);var xc;var e=document.snd.dname.value;for(var i=0;i<dorfnamen.length;i++){if(dorfnamen[i].indexOf(e)>-1){wc++;xc=dorfnamen[i];}
}
if(wc==1){document.snd.dname.value=xc;}
}
var yc=document.getElementById?1:0;var zc=document.all?1:0;var $c=(navigator.userAgent.indexOf("Mac")>-1)?1:0;var _c=(zc&&(!$c)&&(typeof(window.offscreenBuffering)!='undefined'))?1:0;var ad=_c;var bd=_c&&(window.navigator.userAgent.indexOf("SV1")!=-1);function changeOpacity(cd,opacity){if(_c){cd.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='+(opacity*100)+')';}
else if(yc){cd.style.MozOpacity=opacity;}
}
function dd(url,ed,fd,gd){if(fd===undefined){fd='GET';}
var hd;if(window.XMLHttpRequest){hd=new XMLHttpRequest();}
else if(window.ActiveXObject){try{hd=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{hd=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}
}
}
else{throw'Can not create XMLHTTP-instance';}
hd.onreadystatechange=function(){if(hd.readyState==4){if(hd.status==200){var id=hd.getResponseHeader('Content-Type');id=id.substr(0,id.indexOf(';'));switch(id){case'application/json':ed((hd.responseText==''?null:eval('('+hd.responseText+')')));break;case'text/plain':case'text/html':ed(hd.responseText);break;default:throw'Illegal content type';}
}
else{throw'An error has occurred during request';}
}
}
;hd.open(fd,url,true);if(fd=='POST'){hd.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=utf-8');var jd=kd(gd);}
else{var jd=null;}
hd.send(jd);}
function kd(ld){var md='';var nd=true;for(var od in ld){md+=(nd?'':'&')+od+'='+window.encodeURI(ld[od]);if(nd){nd=false;}
}
return md;}
function mreload(){param='reload=auto';url=window.location.href;if(url.indexOf(param)==-1){if(url.indexOf('?')==-1){url+='?'+param;}
else
{url+='&'+param;}
}
document.location.href=url;}
var pd={'index':0,'dir':0,'size':null,'fields':[],'cindex':0,'usealternate':false}
;var m_c=pd;var qd;var rd;var sd;var td;var ud;var vd;var wd;var xd;var yd;var zd=false;var $d;var _d;var ae;var be=[];be[38]=1;be[39]=2;be[40]=3;be[37]=4;var ce={}
;var de;var ee;function map_init(){qd=false;rd=false;sd=false;td=false;vd=0;ud=0;de=fe('karte2');ge(['i','a','t']);if(null==m_c.az){throw'm_c.az muss seitenspezifisch initialisiert werden.';}
for(var p in m_c.az){document.getElementById('ma_'+p).onclick=he;}
var ie=['mcx','mcy','x','y','map_infobox'];for(var i=0;i<ie.length;i++){ce[ie[i]]=document.getElementById(ie[i]);}
ie=['mcx','mcy'];for(var i=0;i<ie.length;i++){ce[ie[i]].onfocus=function(){td=true;}
;ce[ie[i]].onblur=function(){td=false;}
;}
ce.ibox_cells=[];ce.ibox_cells[0]=ce.map_infobox.firstChild.firstChild.lastChild;for(var i=1;i<=3;i++){ce.ibox_cells[i]=ce.map_infobox.firstChild.nextSibling.childNodes[i-1].lastChild}
document.onkeyup=je;document.onkeydown=ke;document.onkeypress=le;document.map_coords.onsubmit=me;ce.mx=[];ce.my=[];for(var i=0;i<mdim.x;i++){for(var j=0;j<mdim.y;j++){area=ne(i,j,'a');area.onmouseover=oe;area.onmouseout=pe;if(de){area.onclick=qe;}
re(m_c.ad[i][j],area);}
ce.mx[i]=document.getElementById('mx'+i);ce.my[i]=document.getElementById('my'+i);}
var se=document.getElementById('map_makelarge');if(se){se.onclick=te;}
if(mdim.x==13){document.getElementById('map_popclose').onclick=ue;}
}
function qe(){opener.location=this.href;return false;}
function ve(we){var xe=document.getElementById('map_makelarge');xe.className=we?'loading':'';}
function ye(ze){var $e;var _e;if(ce.map_infobox!=null){if(ze.normal_field){var af=bf(ze.nr*1);$e=[text_k.verlassenes_tal+': '+af.join('-')];_e='empty';}
else if(ze.free_oasis&&!ze.classic_oasis){$e=[text_k.freie_oase];_e='oasis_empty';}
else if(ze.occupied_oasis&&!ze.classic_oasis){$e=[text_k.besetztes_tal,ze.name,ze.ew,ze.ally];_e='oasis';}
else if(ze.village){$e=[ze.dname,ze.name,ze.ew,ze.ally];_e='village';}
else{$e=[text_k.details];_e='default';}
}
for(var i=0;i<4;i++){ce.ibox_cells[i].innerHTML=($e[i]===undefined||$e[i]==='')?'-':$e[i].replace(/\&/g,"&amp;");}
ce.map_infobox.className=_e;}
function cf(df){ce.x.firstChild.nodeValue=df.x;ce.y.firstChild.nodeValue=df.y;}
function ef(df){ce.mcx.value=df.x;ce.mcy.value=df.y;}
function ff(x,y){return(400+x)+(400-y)*801+1;}
function te(){if(mmode){xd=window.open(this.href,"map","top=100,left=25,width=1007,height=585");xd.focus();}
else{ve(true);dd('ajax.php?f=kp&z='+ff(m_c.z.x,m_c.z.y),function(gf){ve(false);$d=document.getElementsByTagName('body')[0];_d=document.getElementsByTagName('html')[0];$d.parentNode.removeChild($d);ae=document.createElement('body');ae.innerHTML=gf.lm;ae.style.backgroundColor='#ffffff';_d.appendChild(ae);m_c=[];for(var od in gf.dat.m_c){m_c[od]=gf.dat.m_c[od];}
m_c.fields=[];mdim=gf.dat.mdim;mmode=gf.dat.mmode;map_init();}
);}
return false;}
function ue(){if(de){window.close();}
else{mdim={'x':7,'y':7,'rad':3}
;var hf=[];for(var i=0;i<mdim.x;i++){hf[i]=[];for(var j=0;j<mdim.y;j++){hf[i][j]=ne(i+3,j+3,'a').details;}
}
_d.removeChild(ae);_d.appendChild($d);map_init();var jf;var area;for(var i=0;i<mdim.x;i++){for(var j=0;j<mdim.y;j++){area=ne(i,j,'a');jf=ne(i,j,'i');area.details=hf[i][j];area.details.fresh={}
;jf.className=hf[i][j].img;kf(area,jf);}
}
cf(m_c.z);ef(m_c.z);}
return false;}
function he(){var lf=1*this.id.substring(4,5);var mf=1*(this.id.substring(5,7)=='p7'?mdim.x:1);nf(lf,mf);return false;}
function of(z){var x=z.x-mdim.rad;var y=z.y-mdim.rad;var pf=z.x+mdim.rad;var qf=z.y+mdim.rad;return{'x':x,'y':y,'xx':pf,'yy':qf}
;}
function rf(lf,mf,sf){if(sf==null){sf=0;}
if(m_c.size==null){throw'Globale Variable m_c.size muss auf den Wert von $travian[map_prefetch_rows]) gesetzt werden.';}
var tf,uf;if(null===mf||1===mf){uf=m_c.size-1;}
else if(mdim.x==mf){tf=mdim.x;uf=-(mdim.x-1);}
else{throw'Parameter steps muss 1 oder Breite der Karte in Feldern sein.';}
var x,y,pf,qf,z;var z=m_c.z;switch(lf){case 1:x=z.x+mdim.rad;y=z.y+mdim.rad+sf;pf=z.x-mdim.rad;qf=y+uf;break;case 2:x=z.x+mdim.rad+sf;y=z.y-mdim.rad;pf=x+uf;qf=z.y+mdim.rad;break;case 3:x=z.x+mdim.rad;y=z.y-mdim.rad-sf;pf=z.x-mdim.rad;qf=y-uf;break;case 4:x=z.x-mdim.rad-sf;y=z.y-mdim.rad;pf=x-uf;qf=z.y+mdim.rad;break;}
return{'x':x,'y':y,'xx':pf,'yy':qf}
;}
function vf(wf){if(wf>400){wf-=801;}
if(wf<-400){wf+=801;}
return wf;}
function xf(wf){if(wf>400){wf=400;}
if(wf<-400){wf=-400;}
return wf;}
function yf(lf,mf){var z={}
;z.x=m_c.z.x*1;z.y=m_c.z.y*1;switch(lf){case 1:z.y+=mf;break;case 2:z.x+=mf;break;case 3:z.y-=mf;break;case 4:z.x-=mf;break;}
m_c.z.x=vf(z.x);m_c.z.y=vf(z.y);}
function zf($f){return'ajax.php?f=k7&x='+$f.x+'&y='+$f.y+'&xx='+$f.xx+'&yy='+$f.yy;}
function nf(lf,mf,_f){var $f,ag;if(qd){return false;}
if(bg()){if(rd){return false;}
qd=true;cg();m_c.usealternate=false;m_c.cindex=0;if(_f!==undefined){m_c.z.x=xf(_f.x);m_c.z.y=xf(_f.y);$f=of(m_c.z);}
else{yf(lf,mf);$f=rf(lf,mf);}
dg=zf($f);dd(dg,eg);}
else{if(fg()){if(rd){return false;}
rd=true;yf(lf,mf);$f=rf(lf,mf,2);dg=zf($f);dd(dg,eg);}
else if(gg()){yf(lf,mf);hg();cg();}
else{yf(lf,mf);}
ig(lf,mf);}
function eg(jg){var kg;if(fg()){kg=lg(m_c.cindex);m_c.usealternate=false;rd=false;}
else{kg=m_c.cindex;}
m_c.fields[kg]=jg;if(bg()){if(_f!==undefined){ig(0,0,m_c.z);mg('x');mg('y');}
else{ig(lf,mf);mg(lf);}
qd=false;}
}
function fg(){return m_c.usealternate;}
function bg(){return(lf!=m_c.dir||mf==mdim.x||(mf==1&&mf!=m_c.steps)||_f!==undefined);}
function gg(){return(m_c.index==m_c.size);}
}
function ng(lf,mf){m_c.dir=lf;m_c.steps=mf;}
function cg(){m_c.index=0;}
function og(){m_c.index++;if(m_c.index==m_c.size-2){m_c.usealternate=true;}
}
function hg(){m_c.cindex=lg(m_c.cindex);}
function ig(lf,mf,_f){var pg=document.getElementById('map_content');var qg=pg.parentNode;if(1==mf){rg(lf);sg(m_c.fields[m_c.cindex],lf,mf);mg(lf);og();}
else if(mdim.x==mf||_f!==undefined){tg(m_c.fields[m_c.cindex]);}
if(ud==0){ef(m_c.z);}
cf(m_c.z);ng(lf,mf);}
function lg(kg){return(kg==0?1:0);}
function tg(jg){for(var i=0;i<mdim.x;i++){for(var j=0;j<mdim.y;j++){ug(i,j,jg[i][j]);}
}
}
function vg(wg,xg){xg.details.href=wg;}
function ug(yg,zg,ze){var jf=ne(yg,zg,'i');var area=ne(yg,zg,'a');re(ze,area);jf.className=area.details.img;kf(area,jf);}
function kf(area,jf){if(area.details.atyp){if(!jf.firstChild){jf.appendChild(document.createElement('span'));}
jf.firstChild.className='m'+area.details.atyp;}
else{if(jf.firstChild){jf.removeChild(jf.firstChild);}
}
}
function re(ze,area){area.details={}
;var $g=['x','y','nr','typ','querystring','img','dname','name','ew','ally','atyp','atime'];for(var i=0;i<ze.length;i++){area.details[$g[i]]=ze[i];}
area.details.normal_field=area.details.name===undefined&&area.details.typ==0;area.details.free_oasis=area.details.name===undefined&&area.details.typ!=0;area.details.occupied_oasis=area.details.name!==undefined&&area.details.typ!=0;area.details.village=area.details.name!==undefined&&area.details.typ==0;area.details.fresh={}
;area.details.classic_oasis=area.details.querystring==='';}
function bf(_g){switch(_g){case 1:return[3,3,3,9];case 2:return[3,4,5,6];case 3:return[4,4,4,6];case 4:return[4,5,3,6];case 5:return[5,3,4,6];case 6:return[1,1,1,15];case 7:return[4,4,3,7];case 8:return[3,4,4,7];case 9:return[4,3,4,7];case 10:return[3,5,4,6];case 11:return[4,3,5,6];case 12:return[5,4,3,6];default:return false;}
}
function me(){var x=parseInt(this.xp.value);var y=parseInt(this.yp.value);if(!isNaN(x)&&!isNaN(y)){nf(0,0,{'x':x,'y':y}
);}
return false;}
function le(e){if(td){return true;}
var od=(window.event)?event.keyCode:e.keyCode;var lf=ah(od);if(lf!=0){return false;}
}
function oe(){zd=true;cf(this.details);ye(this.details);bh(this);ee=this;}
function bh(area){if(!area.details.fresh.href){if(area.details.classic_oasis){area.removeAttribute('href');area.style.cursor='default';}
else{area.href='karte.php?'+area.details.querystring;area.style.cursor='pointer';}
area.details.fresh.href=true;}
if(!area.details.fresh.title){area.details.fresh.title=ch(area);}
}
function ch(area){if(area.details.normal_field){area.title='';}
else if(area.details.free_oasis&&!area.details.classic_oasis){area.title=text_k.freie_oase;}
else if(area.details.occupied_oasis&&!area.details.classic_oasis){area.title=text_k.besetztes_tal;}
else if(area.details.village){if(area.details.atime!==undefined){area.title=area.details.dname+' '+rb(area.details.atime-Math.floor(new Date().getTime()/1000),true);return false;}
else{area.title=area.details.dname;}
}
else{area.title='';}
return true;}
function pe(){var area=this;window.setTimeout(function(){if(ee==area){zd=false;cf(m_c.z);dh();}
}
,50);}
function sg(jg,lf){var eh,fh;for(var i=0;i<mdim.x;i++){switch(lf){case 1:eh=i;fh=mdim.x-1;ze=jg[i][m_c.index];break;case 2:eh=mdim.x-1;fh=i;ze=jg[m_c.index][i];break;case 3:eh=i;fh=0;ze=jg[i][m_c.size-m_c.index-1];break;case 4:eh=0;fh=i;ze=jg[m_c.size-m_c.index-1][i];break;}
ug(eh,fh,ze);}
}
function gh(x,y,pf,qf){var jf=ne(x,y,'i');var hh=ne(pf,qf,'i');ih(jf,hh);if(jf.firstChild){if(!hh.firstChild){hh.appendChild(document.createElement('span'))}
hh.firstChild.className=jf.firstChild.className;}
else{if(hh.firstChild){hh.removeChild(hh.firstChild);}
}
jh(x,y,pf,qf);}
function jh(x,y,pf,qf){ze=ne(x,y,'a');kh=ne(pf,qf,'a');kh.details=ze.details;kh.details.fresh={}
;}
function ih(jf,hh){hh.className=jf.className;}
function rg(lf){for(var i=0;i<mdim.x;i++){for(var j=1;j<mdim.x;j++){switch(lf){case 1:gh(i,j,i,j-1);break;case 2:gh(j,i,j-1,i);break;case 3:gh(i,mdim.x-1-j,i,mdim.x-j);break;case 4:gh(mdim.x-1-j,i,mdim.x-j,i);break;}
}
}
}
function ah(od){if(be[od]!==undefined){return be[od];}
return 0;}
function je(e){if(td){return true;}
var od=((window.event)?event.keyCode:e.keyCode);if(16==od){sd=false;}
var lf=ah(od);if(lf==ud&&ud!=0){ud=0;ef(m_c.z);lh();}
}
function m_r(lf,mh){if(ud==lf&&mh==vd){window.setTimeout(function(){m_r(lf,mh)}
,100);nf(lf,1);}
}
function mg(nh){var jb;switch(nh){case 2:case 4:case'x':jb='x';break;case 1:case 3:case'y':jb='y';break;}
var oh='m'+jb;var ph;var qh;var rh=0;var sh=0;for(var i=0;i<mdim.x;i++){if(jb=='x'){rh=i;}
else{sh=i;}
if(ce[oh][i]){ph=ne(rh,sh,'a').details[jb];ce[oh][i].firstChild.nodeValue=ph;}
}
}
function ke(e){if(td){return true;}
var od=(window.event)?event.keyCode:e.keyCode;if(od==16){sd=true;}
var lf=ah(od);if(lf!=0&&lf!=ud){var mf=(sd?mdim.x:1);nf(lf,mf);var mh=new Date().getTime();if(mf==1){window.setTimeout(function(){m_r(lf,mh)}
,500);}
vd=mh;ud=lf;lh();}
if(lf!=0){return false;}
}
function lh(){window.setTimeout(function(){if(zd){ye(ee.details);}
}
,60);}
var th={}
;function ne(yg,zg,uh){if(th){return th[uh][yg][zg];}
}
function ge(vh){var uh;for(var i=0;i<vh.length;i++){uh=vh[i];th[uh]=[];for(var yg=0;yg<mdim.x;yg++){th[uh][yg]=[];for(var zg=0;zg<mdim.y;zg++){th[uh][yg][zg]=document.getElementById(uh+'_'+yg+'_'+zg);}
}
}
}
function dh(){ye({wh:'',name:'',xh:'',yh:'',x:m_c.z.x,y:m_c.z.y}
);}
var quest={'anmstep':false}
;function zh(length,$h){if(length===undefined){length=8;}
if($h===undefined){$h=0.5;}
var _h='0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';var zh='';for(var i=0;i<length;i++){var ai=Math.floor((Math.random()+$h)*0.5*_h.length);zh+=_h.substring(ai,ai+1);}
return zh;}
function bi(){var ci='ajax.php?f=qst';var $h=(Math.abs(quest.number)+1)/(Math.abs(quest.last)+1);return ci+'&cr='+zh(4,$h);}
function di(){document.getElementById('ce').innerHTML='';var step;if(quest.anmstep===false){step={'step':{}
,'source':{}
,'current':{}
,'target':{'width':448,'height':482,'top':-1}
,'fps':50,'n':10,'i':0,'anm':{}
}
;step.target[quest.rtl?'right':'left']='-502';}
else{step=quest.anmstep;ei(false);}
step.anm=document.getElementById('anm');for(var fi in step.target){step.source[fi]=Number(step.anm.style[fi].substr(0,step.anm.style[fi].length-2));step.current[fi]=step.source[fi];step.step[fi]=Math.round((step.target[fi]-step.source[fi])/step.n);}
step.timeout=1000/step.fps;quest.cstep=step;quest.anmlock=true;window.setTimeout(anm_step,step.timeout);}
function gi(step){for(var fi in step.target){step.anm.style[fi]=step.current[fi]+'px';}
}
function hi(step){step.i++;if(step.i==2){step.anm.style.visibility='visible';}
for(var fi in step.target){step.current[fi]+=step.step[fi];}
return step;}
function ei(ii){if(ii===undefined){ii==false;}
var ji=document.getElementById('ce');if(ii){var ki='<div id="popup3" class="popup3 quest"></div><a href="#" onClick="qst_handle()"><img src="img/x.gif" border="1" class="popup4" alt="Close"></a>';ji.innerHTML=ki;li();qst_wfm();tc();mi(true);}
else{ji.innerHTML='';mi(false);}
}
function mi(vis){if(!is_ie6){return;}
var ni=vis?'hidden':'visible';var oi=document.getElementsByTagName('select');var n=oi.length;for(var i=0;i<n;i++){oi[i].style.visibility=ni;}
}
function anm_step(){step=hi(quest.cstep);gi(step);if(step.i<step.n){window.setTimeout('anm_step()',step.timeout);}
else{step.anm.style.visibility='hidden';quest.anmlock=false;quest.cstep=false;if(quest.anmstep===false){step.current=step.target;step.target=step.source;step.source=step.current;gi(step);step.i=0;ei(true);quest.anmstep=step;}
else{quest.anmstep=false;if(quest.number>=quest.last||quest.altstep==9){document.getElementById('qge').innerHTML='';}
}
}
}
function pi(){var timer=document.getElementById('qst_timer');if(timer&&timer.parentNode.style.display!='none'){if(!timer.timestamp){timer.timestamp=db()+ob(timer);}
else{var qi=timer.timestamp-db();if(qi<0){timer.parentNode.style.display='none';document.getElementById('qst_reshere').style.display='block';}
else{timer.innerHTML=rb(qi);}
}
window.setTimeout(pi,1000);}
}
function qst_fhandle(){gd={'val':1}
;dd(bi(),function(gf){}
,'POST',gd
);qst_handle();}
function qst_handle(){if(quest.anmlock){return false;}
quest.markup=false;if(quest.anmstep===false){dd(bi(),function(gf){for(var od in gf){quest[od]=gf[od];}
}
);}
di();if(quest.ar){auto_reload=quest.ar;quest.ar=undefined;}
}
function qst_wfm(){var ri=document.getElementById('popup3');if(!quest.markup||!ri){if(!quest.anmlock){window.setTimeout('qst_wfm(true)',50);}
}
else{si(quest);ri.innerHTML=quest.markup;ti=false;if(quest.reward.finish&&window.bld){var ui=document.getElementById('building_contract');if(bld.length<2&&bld[0].gid==1){ui.innerHTML='';ti=0;}
else{for(var i in bld){if(bld[i].stufe==1&&bld[i].gid==1){ui.getElementsByTagName('table')[0].deleteRow(i);ti=i;break;}
}
}
if(ti!==false){var vi=$$('#t3 .rf'+bld[ti].aid)[0];if(vi){vi.removeClass('rf'+bld[ti].stufe);vi.addClass('rf'+bld[ti].stufe+1);}
else{$('f3').appendChild(new Element('img',{'class':('reslevel rf'+bld[ti].aid+' level'+bld[ti].stufe),'src':'img/x.gif'}
));}
}
quest.ar=auto_reload;auto_reload=-1;}
if(quest.reward.plus){var jf=document.getElementById('logo').className='plus';}
quest.markup=false;quest.msg=false;}
}
function qst_weiter(){li();dd(bi(),function(gf){document.getElementById('popup3').innerHTML=gf.markup;var wi=document.getElementById('qgei');wi.className=gf.qgsrc;si(gf);}
);}
function li(){document.getElementById('popup3').innerHTML='<img src="img/x.gif" class="xlo" />';}
function qst_enter(df){if(df===undefined){df=false;}
var gd;if(df){gd={'x':document.getElementById('qst_val_x').value,'y':document.getElementById('qst_val_y').value}
;}
else{gd={'val':document.getElementById('qst_val').value}
;}
li();dd(bi(),function(gf){for(var od in gf){quest[od]=gf[od];}
}
,'POST',gd
);qst_wfm();}
function qst_enter_coords(){qst_enter(true);}
function si(xi){var wi=document.getElementById('qgei');if(wi&&xi.qgsrc){wi.className=xi.qgsrc;}
var yi=document.getElementById('n5');if(yi&&xi.msrc){yi.className=xi.msrc;}
if(xi.cookie){var date=new Date();date.setTime(date.getTime()+300000);document.cookie='t3fw=1; expires='+date.toUTCString()+';';}
if(xi.fest&&fe('dorf2')){document.getElementById('content').innerHTML+=xi.fest;}
window.setTimeout(pi,30);}
function fe(zi){return window.location.href.indexOf(zi+'.php')!=-1;}
function vil_levels_toggle(){var $i=$('levels'),_i=$('lswitch');$i.toggleClass('on');_i.toggleClass('on');if($i.hasClass('on')){document.cookie='t3l=1; expires=Wed, 1 Jan 2020 00:00:00 GMT';}
else{document.cookie='t3l=1; expires=Thu, 01-Jan-1970 00:00:01 GMT';}
}
function aj(){var bj=$('vlist');var cj=$('vlswitch');bj.toggleClass('hide');cj.toggleClass('off');if(bj.hasClass('hide')){document.cookie='t3vl=1; expires=Wed, 1 Jan 2020 00:00:00 GMT';}
else{document.cookie='t3vl=1; expires=Thu, 01-Jan-1970 00:00:01 GMT';}
}
function dj(){var ej=$('llist');var fj=$('llswitch');ej.toggleClass('hide');fj.toggleClass('off');if(ej.hasClass('hide')){document.cookie='t3ll=1; expires=Wed, 1 Jan 2020 00:00:00 GMT';}
else{document.cookie='t3ll=1; expires=Thu, 01-Jan-1970 00:00:01 GMT';}
}
function gmwd(){if(is_ff2&&document.getElementById("gmwi").offsetWidth<50){document.cookie="a3=2; expires=Wed, 1 Jan 2020 00:00:00 GMT";}
else{document.cookie="a3=1; expires=Wed, 1 Jan 2020 00:00:00 GMT";}
}
function gmc(){document.getElementById("gmw").style.display="none";document.cookie="a3=3; expires=Wed, 1 Jan 2020 00:00:00 GMT";}
